import React, { Component } from 'react'
import { hashHistory } from 'react-router'
import { Result  } from 'antd-mobile'
import { CommonHeader } from 'component/header'
import { FormattedMessage } from 'react-intl'


const DepositSuccess = function (props) {
  return (
    <Result
      imgUrl="https://zos.alipayobjects.com/rmsportal/hbTlcWTgMzkBEiU.png"
      title="充值成功"
      message={`流水号：${props.orderId}`}
      buttonText="返回"
      buttonType="default"
      buttonClick={() => hashHistory.push('/account')}
    />
  )
}
const DepositFail = function (props) {
  return (
    <Result
      imgUrl="https://zos.alipayobjects.com/rmsportal/LUIUWjyMDWctQTf.png"
      title="充值失败"
      message="请重新尝试"
      buttonText="返回"
      buttonType="default"
      buttonClick={() => hashHistory.push('/account/depositDraw')}
    />
  )
}


export default class DepositResult extends Component {
  state = {
    result: 0,
    orderId: 0
  }

  render() {
    let result
    switch (this.state.result) {
      case 0:
        result = <DepositSuccess orderId={this.state.orderId} />
        break
      case 1:
        result = <DepositFail orderId={this.state.orderId}/>
        break
    }
    return (
      <div className="deposit-result">
        <CommonHeader title={
            <FormattedMessage id="depositResult"/>
        } />
        {result}
      </div>
    )
  }
}